import lombok.Data;

import java.io.IOException;
import java.io.InputStream;

@Data
public class Request {

    private String url;

    private String method;

    public Request(InputStream inputStream) throws IOException {

        String httpRequest = "";
        byte[] httpRequestBytes = new byte[1024];
        int length = 0;
        if ((length = inputStream.read(httpRequestBytes)) > 0) {
            httpRequest = new String((httpRequestBytes), 0, length);
        }
        String httpHead = httpRequest.split("\n")[0];
        url = httpHead.split("\\s")[1];
        method = httpHead.split("\\s")[0];
    }
}
